package cn.itcast.tlias.com.tliaswork.mapper;

import cn.itcast.tlias.com.tliaswork.pojo.Dept;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface DeptMapper {

    /**
     * 查询全部部门
     * @return
     */
    @Select("SELECT * FROM dept")
    List<Dept> list();


    /**
     * 根据ID删除部门
     * @param id
     */
    @Delete("delete from dept where id = #{id}")
    void deleteId(int id);

    /**
     * 新增部门,#{属性名}
     * @param dept
     */
    @Insert("insert into dept(name,create_time,update_time) values (#{name},#{createTime},#{updateTime})")
    void insert(Dept dept);

    @Update("update dept set name=#{name},update_time=#{updateTime} where id=#{id}")
    void update(Dept dept);

    @Select("SELECT * FROM dept WHERE  id = #{id}")
    Dept searchDeptById(int id);
}
